const getQuery = (url) => {
  const query = url.split("?")[1];
  return query
    ? query.split("&").reduce((acc, cur) => {
        const [key, value] = cur.split("=");
        acc[key] = value;
        return acc;
      }, {})
    : {};
};

const hotList = {
  code: 0,
  data: {
    hotProducts: [
      {
        documentLink:
          "https://www.insta360.com/support/supportdetail?name=acepro&cid=848",
        enabled: true,
        id: 21,
        imageUrl:
          "https://res.insta360.com/static/38de538269d9fe3e853523f7f7611cac/acepro.png",
        name: "insta360-acepro",
      },
      {
        documentLink:
          "https://www.insta360.com/support/supportdetail?name=ace&cid=877",
        enabled: true,
        id: 20,
        imageUrl:
          "https://res.insta360.com/static/81685b969776f4aa9f9203f17a03edb2/ace.png",
        name: "insta360-ace",
      },
      {
        documentLink:
          "https://www.insta360.com/support/supportdetail?name=x3&cid=524",
        enabled: true,
        id: 4,
        imageUrl:
          "https://res.insta360.com/static/infr_base/fb76b585926227c0261ea31a7d58c7aa/download_x3.png",
        name: "insta360-x3",
      },
      {
        documentLink:
          "https://www.insta360.com/support/supportdetail?name=go3&cid=751",
        enabled: true,
        id: 1,
        imageUrl:
          "https://res.insta360.com/static/b4c833c3854dd5858fe6b3605f99689a/go3-download-2.png",
        name: "insta360-go3",
      },
      {
        documentLink:
          "https://www.insta360.com/support/supportdetail?name=onex2&cid=25",
        enabled: true,
        id: 7,
        imageUrl:
          "https://res.insta360.com/static/assets/storage/20201027/3cfd6f55aff009ab06465d452ceb0dfa/onex2.png",
        name: "insta360-onex2",
      },
      {
        documentLink:
          "https://www.insta360.com/support/supportdetail?name=oners&cid=57",
        enabled: true,
        id: 5,
        imageUrl:
          "https://res.insta360.com/static/infr_base/024116933194b0ea869a48976806a65b/%E9%A3%9E%E4%B9%A620220623-094500.png",
        name: "insta360-oners",
      },
      {
        documentLink:
          "https://www.insta360.com/support/supportdetail?name=link&cid=476",
        enabled: true,
        id: 19,
        imageUrl:
          "https://res.insta360.com/static/infr_base/568c7bb7b932548d3a81569439a9177d/insta360_link.png",
        name: "insta360-link",
      },
      {
        documentLink:
          "https://www.insta360.com/support/supportdetail?name=flow&cid=638",
        enabled: true,
        id: 3,
        imageUrl:
          "https://res.insta360.com/static/726de4c7d396dba75554fdf11d4deff0/icon_flow_download.png",
        name: "insta360-flow",
      },
    ],
    hotSoftWares: [
      {
        deviceType: "",
        androidPrivacyUrl:
          "https://www.insta360.com/cn/support/supportcourse?post_id=20166",
        description:
          "配合Insta360相机和手机稳定器（Ace/Ace Pro & GO 3/GO 2 & Flow & X3/X2/X & ONE RS/R & Sphere）使用，拥有无限编辑空间！集齐多种功能，带给您全新体验。",
        language: "zh_CN",
        logo_image:
          "https://res.insta360.com/static/assets/storage/20200820/79ccfd476ab3a42c6ba3811446d56797/512x512.png",
        iosPrivacyUrl:
          "https://www.insta360.com/cn/support/supportcourse?post_id=20166",
        iosProtocolUrl:
          "https://www.insta360.com/support/supportcourse?post_id=9142",
        main_name: "Insta360",
        name: "相机和手机稳定器控制APP",
        title_image:
          "https://res.insta360.com/static/infr_base/4351b47c8d512466afa6d40e708fe705/Insta360%20ONE%20RS(%E7%81%B0)@1x.png",
        androidProtocolUrl:
          "https://www.insta360.com/support/supportcourse?post_id=9142",
        id: 67,
        app_id: 67,
        items: [
          {
            is_mininum_version: false,
            website_visible: true,
            forced: false,
            description:
              "<p>1. 仪表盘功能新增了佳明功率数据显示。</p>\n<p>2. 剪辑页一键成片功能支持选择修剪后的文件。</p>",
            language: "zh_CN",
            version: "1.55.1",
            platform: "ios",
            app_visible: true,
            itemId: 796,
            update_time: 1703824228000,
            channels: [
              {
                channel: "itunes",
                download_url: "https://apps.apple.com/app/id1491299654",
                file_size: 0,
                item_id: 796,
                order_index: 0,
                visible: true,
              },
            ],
            important_tag: false,
            releaseStatus: 1,
            id: 796,
            is_test: false,
            app_id: 67,
          },
          {
            is_mininum_version: false,
            website_visible: true,
            forced: false,
            description:
              "<p>1. 仪表盘功能新增了佳明功率数据显示。</p>\n<p>2. 剪辑页一键成片功能支持在成片后切换时长。</p>",
            language: "zh_CN",
            version: "1.55.1",
            platform: "android",
            app_visible: false,
            itemId: 800,
            update_time: 1704256457000,
            channels: [
              {
                channel: "official",
                download_url:
                  "https://file.insta360.com/static/1baa6b88c5d6704a1cc417b4db506932/Insta360_v1.55.1_1443.apk",
                file_md5: "f543ab26644a9f7a57b6a8d3844d5a75",
                file_size: 893138659,
                item_id: 800,
                order_index: 0,
                visible: true,
              },
            ],
            important_tag: false,
            releaseStatus: 1,
            id: 800,
            is_test: false,
            app_id: 67,
          },
          {
            is_mininum_version: false,
            website_visible: true,
            forced: false,
            description:
              "<p>1. 剪辑页 AI 魔术师功能开放支持更多相机：X3、ONE X2、ONE X、GO 3、GO 2、Flow、ONE RS、ONE R、Sphere 拍摄的全景视频、平面视频素材。</p>",
            language: "zh_CN",
            version: "1.56.1",
            platform: "ios",
            app_visible: true,
            itemId: 805,
            update_time: 1705109997000,
            channels: [
              {
                channel: "itunes",
                download_url: "https://apps.apple.com/app/id1491299654",
                file_size: 0,
                item_id: 805,
                order_index: 0,
                visible: true,
              },
            ],
            important_tag: false,
            releaseStatus: 1,
            id: 805,
            is_test: false,
            app_id: 67,
          },
          {
            is_mininum_version: false,
            website_visible: true,
            forced: false,
            description:
              "<p>1. 剪辑页 AI 魔术师功能开放支持更多相机：X3、ONE X2、ONE X、GO 3、GO 2、Flow、ONE RS、ONE R、Sphere 拍摄的全景视频、平面视频素材。</p>",
            language: "zh_CN",
            version: "1.56.0",
            platform: "android",
            app_visible: false,
            itemId: 806,
            update_time: 1705118489000,
            channels: [
              {
                channel: "official",
                download_url:
                  "https://file.insta360.com/static/1ad98aa9d5aaff578d74af36bea501fb/Insta360_v1.56.0_1454.apk",
                file_md5: "614adecf166496e5b5a049bbf5275f62",
                file_size: 904869052,
                item_id: 806,
                order_index: 0,
                visible: true,
              },
            ],
            important_tag: false,
            releaseStatus: 1,
            id: 806,
            is_test: false,
            app_id: 67,
          },
        ],
        key: "oner",
      },
      {
        deviceType: "",
        note: "",
        description:
          "使用Insta360 Studio 2023，方便你对Insta360消费级产品拍摄的视频和图片进行编辑。此安装包包含Adobe Premiere Pro（2019/2020/2021）插件和Final Cut Pro X插件（暂仅支持ONE R广角视频），安装后可直接在Premiere/Final Cut Pro X查看和编辑mp4格式文件。",
        language: "zh_CN",
        logo_image:
          "https://res.insta360.com/static/ff9fd218c481205835d2bce8ab722838/Studio512.png",
        unsupport_text: "仅支持 Windows 和 Mac",
        name_link_url:
          "https://www.insta360.com/cn/support/supportcourse?post_id=20713",
        description_link_text: "常见问题",
        main_name: "Insta360 STUDIO 2023",
        name: "后期处理软件",
        title_image:
          "https://static.insta360.com/assets/storage/20200323/99e9f3da79cfa1240d71dc0aa2d60a18/Insta360_studio_2020_2x.png",
        id: 38,
        description_link_url:
          "https://www.insta360.com/support/supportcourse?post_id=18163",
        app_id: 38,
        items: [
          {
            is_mininum_version: false,
            website_visible: true,
            forced: false,
            description:
              "适用于X3的 LOG 视频 LUT。 支持AfterEffects、Premiere、DaVinci、Final cut、Photoshop、Lightroom等主流调色软件。\n",
            language: "zh_CN",
            version: "2.1.0",
            platform: "desktop",
            app_visible: false,
            itemId: 449,
            update_time: 1662637165000,
            version_name: "LUT",
            channels: [
              {
                channel: "official",
                download_url:
                  "https://file.insta360.com/static/infr_base/cf676f1b13f50de791e8747cb00a3e77/Insta360-LUT.zip",
                file_md5: "abab2cbe4252367f5917228288821c3b",
                file_size: 24886915,
                item_id: 449,
                order_index: 0,
                visible: true,
              },
            ],
            important_tag: false,
            releaseStatus: 1,
            id: 449,
            is_test: false,
            app_id: 38,
          },
          {
            is_mininum_version: false,
            website_visible: true,
            forced: false,
            description:
              "<p>1. 支持新品 影石Insta360 Ace 和 Ace Pro 相机。</p>\n<p>2. 新增 ND镜特效，即使没有 ND 滤镜，也能拍出电影感、速度感大片，适合骑行第一人称视角使用。</p>\n<p>3. 用户体验优化和部分 Bug 修复。</p>",
            language: "zh_CN",
            version: "4.9.1",
            platform: "mac",
            app_visible: false,
            itemId: 778,
            update_time: 1700805698000,
            channels: [
              {
                channel: "official",
                download_url:
                  "https://file.insta360.com/static/068d309c5f7268f99dce70a523b264cb/Insta360Studio2023_4.9.1_20231123_173818_1700732479763.pkg",
                file_md5:
                  "o4d37EpowfPwQCbH1W388tlyOivqT5r7w4iIehnPd7hMc4jQpA+wG5IROjmaJ9uZUqNq1s737JIdiUKmYyGvDw==",
                file_size: 470133835,
                item_id: 778,
                order_index: 0,
                visible: true,
              },
            ],
            important_tag: false,
            releaseStatus: 1,
            id: 778,
            is_test: false,
            app_id: 38,
          },
          {
            is_mininum_version: false,
            website_visible: true,
            forced: false,
            description:
              "<p>1. 支持新品 影石Insta360 Ace 和 Ace Pro 相机。</p>\n<p>2. 新增 ND镜特效，即使没有 ND 滤镜，也能拍出电影感、速度感大片，适合骑行第一人称视角使用。</p>\n<p>3. 用户体验优化和部分 Bug 修复。</p>",
            language: "zh_CN",
            version: "4.9.1",
            platform: "windows",
            app_visible: false,
            itemId: 779,
            update_time: 1700805943000,
            channels: [
              {
                channel: "official",
                download_url:
                  "https://file.insta360.com/static/479aafd53706250e85021cbb24dda777/Insta360%20Studio%202023_Winx64_4.9.1_build_202311231828.exe",
                file_md5:
                  "MEQCIHpCA66Szim2LXzf3F8vYubBU9HpnGPO1EzieqBjo0WYAiB/iukW2EkaQTx1dD5ibX00HcRIGMmNPNTorFVdaQiXpw==",
                file_size: 362187672,
                item_id: 779,
                order_index: 0,
                visible: true,
              },
            ],
            important_tag: false,
            releaseStatus: 1,
            id: 779,
            is_test: false,
            app_id: 38,
          },
        ],
        key: "studio2019",
        name_link_text: "Studio 使用教程",
      },
    ],
    subMenus: [],
  },
};

const consumerList = {
  code: 0,
  data: {
    subMenus: [
      {
        hotProducts: [
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=x3&cid=524",
            enabled: true,
            id: 4,
            imageUrl:
              "https://res.insta360.com/static/infr_base/fb76b585926227c0261ea31a7d58c7aa/download_x3.png",
            name: "insta360-x3",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=oners&cid=57",
            enabled: true,
            id: 5,
            imageUrl:
              "https://res.insta360.com/static/infr_base/024116933194b0ea869a48976806a65b/%E9%A3%9E%E4%B9%A620220623-094500.png",
            name: "insta360-oners",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=onex2&cid=25",
            enabled: true,
            id: 7,
            imageUrl:
              "https://res.insta360.com/static/assets/storage/20201027/3cfd6f55aff009ab06465d452ceb0dfa/onex2.png",
            name: "insta360-onex2",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=oner&cid=46",
            enabled: true,
            id: 8,
            imageUrl:
              "https://static.insta360.com/assets/storage/20200105/e408dc7a2b6b4946de6833b64490071c/oner_2x.png",
            name: "insta360-oner",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=sphere&cid=456",
            enabled: true,
            id: 2,
            imageUrl:
              "https://res.insta360.com/static/infr_base/c75e5344a9cc501f0d37a87b68eeb479/sphere.png",
            name: "insta360-sphere",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=onex",
            enabled: true,
            id: 11,
            imageUrl:
              "https://static.insta360.com/assets/www/images/download/product-onex.png",
            name: "insta360-onex",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=evo",
            enabled: true,
            id: 10,
            imageUrl:
              "https://static.insta360.com/assets/storage/20190314/148d8f80e183f5ef0864631c0f626612/download_evo@2x.png",
            name: "insta360-evo",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=one",
            enabled: true,
            id: 12,
            imageUrl:
              "https://static.insta360.com/assets/www/images/download/product-one.png",
            name: "insta360-one",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=nanos",
            enabled: true,
            id: 13,
            imageUrl:
              "https://static.insta360.com/assets/www/images/download/product-nanos.jpg",
            name: "insta360-nanos",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=nano",
            enabled: true,
            id: 14,
            imageUrl:
              "https://static.insta360.com/assets/www/images/download/product-nano.png",
            name: "insta360-nano",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=air",
            enabled: true,
            id: 15,
            imageUrl:
              "https://static.insta360.com/assets/www/images/download/product-air.png",
            name: "insta360-air",
          },
        ],
        subMenuName: "全景相机",
      },
      {
        hotProducts: [
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=acepro&cid=848",
            enabled: true,
            id: 21,
            imageUrl:
              "https://res.insta360.com/static/38de538269d9fe3e853523f7f7611cac/acepro.png",
            name: "insta360-acepro",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=ace&cid=877",
            enabled: true,
            id: 20,
            imageUrl:
              "https://res.insta360.com/static/81685b969776f4aa9f9203f17a03edb2/ace.png",
            name: "insta360-ace",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=go3&cid=751",
            enabled: true,
            id: 1,
            imageUrl:
              "https://res.insta360.com/static/b4c833c3854dd5858fe6b3605f99689a/go3-download-2.png",
            name: "insta360-go3",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=go2&cid=12",
            enabled: true,
            id: 6,
            imageUrl:
              "https://res.insta360.com/static/assets/storage/20210309/94c3f4c78bc1ac235c482fd5a377b72e/Download-GO2.png",
            name: "insta360-go2",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=go",
            enabled: true,
            id: 9,
            imageUrl:
              "https://static.insta360.com/assets/storage/20190823/2089e131d6aad01ec57a3145063a439d/download_GO_2x.png",
            name: "insta360-go",
          },
        ],
        subMenuName: "运动相机",
      },
      {
        hotProducts: [
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=flow&cid=638",
            enabled: true,
            id: 3,
            imageUrl:
              "https://res.insta360.com/static/726de4c7d396dba75554fdf11d4deff0/icon_flow_download.png",
            name: "insta360-flow",
          },
        ],
        subMenuName: "手持摄影设备",
      },
      {
        hotProducts: [
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=link&cid=476",
            enabled: true,
            id: 19,
            imageUrl:
              "https://res.insta360.com/static/infr_base/568c7bb7b932548d3a81569439a9177d/insta360_link.png",
            name: "insta360-link",
          },
        ],
        subMenuName: "网络摄像头",
      },
    ],
  },
};

const professionalList = {
  code: 0,
  data: {
    subMenus: [
      {
        hotProducts: [
          {
            documentLink:
              "https://onlinemanual.insta360.com/pro2/en-us/compare/appearance-interface?r_from=%2Fpro2%2Fen-us%2F",
            enabled: true,
            id: 17,
            imageUrl:
              "https://static.insta360.com/assets/www/images/download/product-pro2.png",
            name: "insta360-pro2",
          },
          {
            documentLink:
              "https://onlinemanual.insta360.com/titan/en-us/compare/specification?r_from=%2Ftitan%2Fen-us%2F",
            enabled: true,
            id: 16,
            imageUrl:
              "https://static.insta360.com/assets/storage/20190626/1bb960954aefca82d5f11643a2f71a14/download_titan@2x.png",
            name: "insta360-titan",
          },
          {
            documentLink:
              "https://www.insta360.com/support/supportdetail?name=pro",
            enabled: true,
            id: 18,
            imageUrl:
              "https://static.insta360.com/assets/www/images/download/product-pro.png",
            name: "insta360-pro",
          },
        ],
        subMenuName: "专业级VR相机",
      },
    ],
  },
};

const dataObj = {
  hot: hotList,
  consumer: consumerList,
  professional: professionalList,
};
export default defineEventHandler((event) => {
  const type = getQuery(event._path).type;
  return dataObj[type];
});
